#include <stdio.h>
#include "pokersleuth.h"

int main(int argc, char* argv[])
{
        struct parse_error parse_error;
        const char *str_ranges[10];
        double equity[10];
        int no_players = argc - 2;
        const char *board;
        int i;
        int rv;

        if (argc < 4) {
                printf("Usage: equitycalc board holes ...\n");
                return 1;
        }

        board = argv[1];

        for (i = 0; i < no_players; i++)
                str_ranges[i] = argv[i+2];

        rv = compute_equity(no_players, str_ranges, board, equity, 
                            &parse_error);

        if (rv) {
                printf("%d:%d:%d: %s\n", parse_error.player, 
                        parse_error.cols[0], parse_error.cols[1], 
                        parse_error.msg);
                return 1;
        }

        for (i = 0; i < no_players; i++)
                printf("%f\n", equity[i]);
 
	return 0;
}

